﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;

namespace Behavioral.Tests
{
    [TestFixture]
    public class GenericTests
    {
        #region Assertions do not have to match their unit tests
        
        [Test]
        public void AssertionsDoNotHaveToMatchTheirUnitTests()
        {
            var testClass = new VoidTestWithMasmatchingAssertion();
            testClass.RunVoidTestWithMismatchingAssertion();
        }

        class VoidTestWithMasmatchingAssertion : UnitTest<int>
        {
            public void RunVoidTestWithMismatchingAssertion()
            {
                GivenThat<NoOpInitializer>()
                .When<NoOpAction>()
                .Then<NoOpAssertion>();
            }
        }

        private class NoOpInitializer : IInitializer<int>
        {
            public void SetUp(ref int target)
            {
                Assert.AreEqual(0, target);
                target = 1;
            }
        }

        class NoOpAction : IAction<int>
        {
            public void Execute(int target)
            {
                Assert.AreEqual(1, target);
            }
        }

        class NoOpAssertion : IAssertion<int>
        {
            public void Verify(int target)
            {
                Assert.AreEqual(1, target);
            }
        }

        #endregion
    }
}
